package string;
/*
正则表达式
 */
public class MatchesDemo {
    public static void main(String[] args) {
        /*
        邮箱的正则表达式
        [a-zA-Z0-9]+@[a-zA-Z0-9]+(\\.[a-zA-Z0-9]+)+
         */
        String email = "2679459676@qq.com";
        if (email.matches(
                "[a-zA-Z0-9]+@[a-zA-Z0-9]+(\\.[a-zA-Z0-9]+)+")) {
            System.out.println("邮箱格式正确");
        } else {
            System.out.println("邮箱格式错误");
        }
    }
}
